const notUseGroup = [
  /documentation/,
  /CamundaPlatform__Form*/,
  /CamundaPlatform__JobExecution/,
  /CamundaPlatform__StartInitiator/,
  /CamundaPlatform__AsynchronousContinuations/,
  /CamundaPlatform__CandidateStarter/,
  /CamundaPlatform__ExternalTask/,
  /CamundaPlatform__HistoryCleanup/,
  /CamundaPlatform__Tasklist/,
  /CamundaPlatform__Output/,
  /CamundaPlatform__Input/,
  /CamundaPlatform__UserAssignment/,
  /CamundaPlatform__TaskListener/
]

export default class ExamplePropertiesProvider {
  constructor(propertiesPanel, translate) {
    this._translate = translate
    propertiesPanel.registerProvider(100, this)
  }

  getGroups(element) {
    return (groups) => {
      const newGroup = []
      groups.forEach((item) => {
        let flag = false
        notUseGroup.forEach((g) => {
          if (g.test(item.id)) {
            flag = true
          }
        })
        if (!flag) {
          item.label = this._translate(item.label)
          newGroup.push(item)
        }
      })
      return newGroup
    }
  }
}

ExamplePropertiesProvider.$inject = ['propertiesPanel', 'translate']
